Skip to main content

Query User Balance

Type: GET

Description: /v4/referal/invite/user/balance

Channels / partners can query the account balance of a specific sub-user. In addition to the total balance, the response breaks down the spot account and futures account (total / coin-margined / USDT-margined) balances. All values are converted to USDT.

All requests require API key signature. See Signature Generation.

  • The caller must be a channel / partner (CHANNEL / PARTNER), and uid must be a sub-user under the caller.
  • Balance fields are returned as strings. If an account has no balance, "0" is returned.
  • futuresBalance = futuresCoinBalance + futuresUsdtBalance.

Request Parameters​

NameTypeRequiredDefaultDescriptionValue Range
uidlongYes-Sub-user UIDMust be a sub-user under the caller

Request Example​

Request
curl -s 'https://api.xt.com/v4/referal/invite/user/balance?uid=10000001' \
-H 'validate-algorithms: HmacSHA256' \
-H 'validate-appkey: {accessKey}' \
-H 'validate-recvwindow: 60000' \
-H 'validate-timestamp: {timestamp}' \
-H 'validate-signature: {signature}'

Response Example​

Response
{
"rc": 0,
"mc": "SUCCESS",
"ma": [],
"result": {
"userId": 10000001, // Sub-user UID
"role": "DIRECTOR", // Role: CHANNEL / PARTNER / DIRECTOR
"balance": "1234.5678", // Total balance (in USDT)
"spotBalance": "800.1234", // Spot account balance (in USDT)
"futuresBalance": "434.4444", // Total futures account balance (in USDT)
"futuresCoinBalance": "34.4444", // Coin-margined futures balance (in USDT)
"futuresUsdtBalance": "400.0000" // USDT-margined futures balance (in USDT)
}
}

Response Fields​

NameTypeDescription
userIdlongSub-user UID
rolestringRole: CHANNEL / PARTNER / DIRECTOR (channel / partner / direct user)
balancestringTotal balance (in USDT)
spotBalancestringSpot account balance (in USDT)
futuresBalancestringTotal futures account balance (in USDT): coin-margined plus USDT-margined
futuresCoinBalancestringCoin-margined futures balance (in USDT)
futuresUsdtBalancestringUSDT-margined futures balance (in USDT)

Message Codes (mc)​

mcDescription
SUCCESSSuccess (rc=0)
AUTH_101API key does not exist or has been deleted
AUTH_103Invalid signature. Check how the signature string is built
AUTH_104Request IP is not bound to the API key
AUTH_105Request expired: local time differs from server time by more than recvWindow
COSMOS_1001Asset service query failed
COSMOS_1012No permission to view this user (uid is not a sub-user of the caller)
COSMOS_1013User not found